package com.fone.player.airone;

import java.io.Serializable;

public class AirServerDevice implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 130322L;
	/**
	 * 0为airplay,非0为dlna
	 */
	public int proto;
	public String server_name;
	public String server_ip_addr;
	public int server_port;
	public String server_uid;
	
	public int media_index = -1;
	public int player_state = -1;

	public int seek_pos;
	
	public boolean checked;
	
	public boolean logined;
	/**请求状态连续错误次数*/
	public int error_times = 0;
	
	
	public String toString(){
		
		return "proto:"+proto+" "
			+  "server_name:"+server_name+" "
			+  "server_ip_addr:"+server_ip_addr+" "
			+  "server_port:"+server_port+" "
			+  "server_uid:"+server_uid;
	}
	public void copyTo(AirServerDevice dev) {
		dev.media_index = media_index;
		dev.player_state = player_state;
		dev.checked = checked;
//		dev.server_name = server_name;
		dev.logined = logined;
	}
	static int off = 5;
	public boolean isSeekingIn(int pos) {
		if( seek_pos == 0 )
			return true;
		if( proto == 0 )
			return Math.abs(seek_pos-pos)>off*1000;
		else
			return Math.abs(seek_pos-pos)>off;
	}
}
